<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05-Cookie</title>
    <script>
        function addCookie() {// 添加cookie
            document.cookie="zyh=123;expires=Mon Jan 08 2025 15:62:39 GMT;path=/";
        }
        function deleteCookie() {// 删除cookie
            document.cookie="zyh=;expires=Mon Jan 08 1970 15:62:39 GMT;path=/";
        }
        function updateCookie() {// 更新cookie
            document.cookie="zyh=321;expires=Mon Jan 08 2026 15:62:39 GMT;path=/";
        }
        function showCookie() {// 展示cookie
            alert(document.cookie);
        }
    </script>
</head>
<body>
<button id="btn1" onclick="addCookie()">添加cookie</button>
<button id="btn2" onclick="deleteCookie()">删除cookie</button>
<button id="btn3" onclick="updateCookie()">修改cookie</button>
<button id="btn4" onclick="showCookie()">显示cookie</button>
</body>
</html>